package com.niannian.dialog;

import android.content.Context;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;
import android.widget.ProgressBar;

import com.niannian.R;
import com.niannian.view.HandyTextView;

public class FlippingLoadingDialog extends BaseDialog {

	private HandyTextView mHtvText;
	private String mText;
	private ImageView mFivIcon;
	private Context context;
	ProgressBar iv_round2;

	public FlippingLoadingDialog(Context context, String text) {
		super(context);
		mText = text;
		this.context = context;
		init();
	}

	private void init() {
		setContentView(R.layout.loading);
		mFivIcon = (ImageView) findViewById(R.id.iv_round);
		// Animation myAnimation_Rotate = new RotateAnimation(0.0f, 360.0f,
		// Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
		// myAnimation_Rotate.setDuration(1000);
		// myAnimation_Rotate.setRepeatCount(-1);
		// myAnimation_Rotate.setRepeatMode(Animation.RESTART);
		// mFivIcon.setAnimation(AnimationUtils.loadAnimation(context,
		// R.anim.ic_loading));
		iv_round2 = (ProgressBar) findViewById(R.id.iv_round2);
		mHtvText = (HandyTextView) findViewById(R.id.loadingdialog_htv_text);
		mHtvText.setText(mText);
	}

	public void setText(String text) {
		mText = text;
		mHtvText.setText(mText);
	}

	@Override
	public void dismiss() {
		if (isShowing()) {
			super.dismiss();
		}
	}
}
